this.BX=this.BX||{};(function(t,e){"use strict";function i(t,e){s(t,e);e.add(t)}function s(t,e){if(e.has(t)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function n(t,e,i){if(!e.has(t)){throw new TypeError("attempted to get private field on non-instance")}return i}var a=new WeakSet;var l=new WeakSet;var h=new WeakSet;var r=new WeakSet;var o=function t(s){var o=s.element,u=s.touchStartCallback,d=s.touchEndCallback,p=s.touchMoveCallback;babelHelpers.classCallCheck(this,t);i(this,r);i(this,h);i(this,l);i(this,a);this.element=e.Type.isDomNode(o)?o:null;this.touchStartCallback=u;this.touchEndCallback=d;this.touchMoveCallback=p;this.active=false;this.currentY=null;this.initialY=null;this.yOffset=0;n(this,a,c).call(this)};function c(){if(this.element){this.element.addEventListener("touchstart",n(this,l,u).bind(this));this.element.addEventListener("touchend",n(this,h,d).bind(this));this.element.addEventListener("touchmove",n(this,r,p).bind(this))}}function u(t){this.active=true;this.element.classList.add("--ondrag");if(t.type==="touchstart"){this.initialY=t.touches[0].clientY-this.yOffset}else{this.initialY=t.clientY-this.yOffset}if(!this.touchStartCallback){return}this.touchStartCallback({element:this.element,active:this.active,currentY:this.currentY,initialY:this.initialY,yOffset:this.offSetY})}function d(t){this.active=true;this.element.classList.remove("--ondrag");this.yOffset=0;this.initialY=this.currentY;if(!this.touchEndCallback)return;this.touchEndCallback({element:this.element,active:this.active,currentY:this.currentY,initialY:this.initialY,yOffset:this.offSetY})}function p(t){if(!this.active){return}t.preventDefault();if(t.type==="touchmove"){this.currentY=t.touches[0].clientY-this.initialY}else{this.currentY=t.clientY-this.initialY}this.yOffset=this.currentX;if(!this.touchMoveCallback){return}this.touchMoveCallback({element:this.element,active:this.active,currentY:this.currentY,initialY:this.initialY,yOffset:this.offSetY})}var f,v,y,m,g,b,T,Y;function k(t,e){w(t,e);e.add(t)}function w(t,e){if(e.has(t)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function L(t,e,i){if(!e.has(t)){throw new TypeError("attempted to get private field on non-instance")}return i}var _=new WeakSet;var H=new WeakSet;var S=new WeakSet;var C=new WeakSet;var E=new WeakSet;var O=new WeakSet;var P=function(){function t(i){var s=this;var n=i.content,a=i.help,l=i.className,h=i.padding;babelHelpers.classCallCheck(this,t);k(this,O);k(this,E);k(this,C);k(this,S);k(this,H);k(this,_);this.content=e.Type.isDomNode(n)?n:null;this.className=e.Type.isString(l)?l:"";this.padding=e.Type.isString(h)||e.Type.isNumber(h)?h:null;this.help=null;switch(true){case e.Type.isString(a):this.help=a;break;case e.Type.isFunction(a):this.help=a;break}this.layout={wrapper:null,container:null,content:null,overlay:null,close:null,help:null};this.halfOfHeight=0;this.currentHeight=null;this.sheetListener=new o({element:L(this,C,W).call(this),touchStartCallback:function t(e){var i=e.element,s=e.active,n=e.initialY,a=e.currentY,l=e.yOffset;i.style.setProperty("--translateY","translateY(0)");i.style.setProperty("transition","unset")},touchEndCallback:function t(e){var i=e.element,n=e.active,a=e.initialY,l=e.currentY,h=e.yOffset;i.style.setProperty("transition","transform .3s");i.style.setProperty("--translateY","translateY("+l+"px)");if(parseInt(l)>s.halfOfHeight){s.close()}},touchMoveCallback:function t(e){var i=e.element,s=e.active,n=e.initialY,a=e.currentY,l=e.yOffset;if(a<=0){return}if(a<=-40){a=-41+a/10}i.style.setProperty("--translateY","translateY("+a+"px)")}});if(this.content){this.setContent(this.content)}}babelHelpers.createClass(t,[{key:"setContent",value:function t(i){if(e.Type.isDomNode(i)){e.Dom.clean(L(this,E,B).call(this));L(this,E,B).call(this).appendChild(i)}if(e.Type.isString(i)){e.Dom.clean(L(this,E,B).call(this));L(this,E,B).call(this).innerText=i}}},{key:"adjustPosition",value:function t(){}},{key:"adjustSize",value:function t(){var e=this;if(this.currentHeight!==L(this,C,W).call(this).offsetHeight){var i=this.currentHeight;var s=L(this,C,W).call(this).offsetHeight;L(this,C,W).call(this).style.setProperty("height",i+"px");setTimeout((function(){i=L(e,C,W).call(e).offsetHeight;L(e,C,W).call(e).style.setProperty("height",s+"px");var t=function t(){L(e,C,W).call(e).style.removeProperty("height",s+"px");L(e,C,W).call(e).removeEventListener("transitionend",t)};L(e,C,W).call(e).addEventListener("transitionend",t);e.currentHeight=s;e.halfOfHeight=e.currentHeight/2}))}}},{key:"close",value:function t(){var e=this;if(L(this,O,D).call(this).parentNode){L(this,C,W).call(this).classList.remove("--show");L(this,_,M).call(this).classList.remove("--show");var i=function t(){L(e,O,D).call(e).classList.remove("--show");L(e,C,W).call(e).removeEventListener("transitionend",t)};L(this,C,W).call(this).addEventListener("transitionend",i)}}},{key:"show",value:function t(){var e=this;if(!L(this,O,D).call(this).parentNode){L(this,O,D).call(this).appendChild(L(this,_,M).call(this));L(this,O,D).call(this).appendChild(L(this,C,W).call(this));document.body.appendChild(L(this,O,D).call(this))}L(this,O,D).call(this).classList.add("--show");setTimeout((function(){e.currentHeight=L(e,C,W).call(e).offsetHeight;e.halfOfHeight=e.currentHeight/2;L(e,C,W).call(e).classList.add("--show");L(e,_,M).call(e).classList.add("--show")}))}}]);return t}();function M(){if(!this.layout.overlay){this.layout.overlay=e.Tag.render(f||(f=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-bottomsheet__overlay"></div>\n\t\t\t'])));this.layout.overlay.addEventListener("click",this.close.bind(this))}return this.layout.overlay}function x(){var t=this;if(!this.layout.help){if(e.Type.isString(this.help)){this.layout.help=e.Tag.render(v||(v=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<a href="','" class="ui-bottomsheet__panel-control--item --cursor-pointer">\n\t\t\t\t\t\t<span class="ui-bottomsheet__panel-control--item-text">',"</span>\n\t\t\t\t\t</a>\n\t\t\t\t"])),this.help,e.Loc.getMessage("UI_BOTTOMSHEET_HELP"))}if(e.Type.isFunction(this.help)){this.layout.help=e.Tag.render(y||(y=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<div class="ui-bottomsheet__panel-control--item --cursor-pointer">\n\t\t\t\t\t\t<div class="ui-bottomsheet__panel-control--item-text">',"</div>\n\t\t\t\t\t</div>\n\t\t\t\t"])),e.Loc.getMessage("UI_BOTTOMSHEET_HELP"));this.layout.help.addEventListener("click",(function(){t.help()}))}}return this.layout.help}function N(){if(!this.layout.close){this.layout.close=e.Tag.render(m||(m=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-bottomsheet__panel-control--item --cursor-pointer --close">\n\t\t\t\t\t<div class="ui-bottomsheet__panel-control--item-text">',"</div>\n\t\t\t\t</div>\n\t\t\t"])),e.Loc.getMessage("UI_BOTTOMSHEET_CLOSE"));this.layout.close.addEventListener("click",this.close.bind(this))}return this.layout.close}function W(){if(!this.layout.container){var t=e.Tag.render(g||(g=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-bottomsheet__panel-wrapper">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),L(this,E,B).call(this));if(this.padding||this.padding===0){var i;switch(true){case e.Type.isString(this.padding):i=this.padding;break;case e.Type.isNumber(this.padding):i=this.padding+"px";break}t.style.setProperty("padding",i)}this.layout.container=e.Tag.render(b||(b=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-bottomsheet__panel">\n\t\t\t\t\t<div class="ui-bottomsheet__panel-control">\n\t\t\t\t\t\t','\n\t\t\t\t\t\t<div class="ui-bottomsheet__panel-handler"></div>\n\t\t\t\t\t\t',"\n\t\t\t\t\t</div>\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),this.help?L(this,H,x).call(this):"",L(this,S,N).call(this),t)}return this.layout.container}function B(){if(!this.layout.content){this.layout.content=e.Tag.render(T||(T=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-bottomsheet__panel-content"></div>\n\t\t\t'])))}return this.layout.content}function D(){if(!this.layout.wrapper){this.layout.wrapper=e.Tag.render(Y||(Y=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-bottomsheet ui-bottomsheet__scope ','"></div>\n\t\t\t'])),this.className)}return this.layout.wrapper}t.BottomSheet=P})(this.BX.UI=this.BX.UI||{},BX);
//# sourceMappingURL=bottomsheet.bundle.map.js